package com.GraduationDesign.backend.po;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 
 * @TableName qualitydata
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Qualitydata implements Serializable {
    /**
     * 
     */
    private Long id;

    /**
     * 复杂性数值
     */
    private Double complexity;

    /**
     * 可继承性数值
     */
    private Double inheritance;

    /**
     * 可维护性数值
     */
    private Double maintainability;

    /**
     * 可读性数值
     */
    private Double readability;

    /**
     * 可复用性数值
     */
    private Double reuseablity;

    /**
     * 可测试性数值
     */
    private Double testability;

    /**
     * 可扩展性数值
     */
    private Double extendability;

    /**
     * 安全性数值
     */
    private Double security;

    private static final long serialVersionUID = 1L;

    public void round(){
        BigDecimal bd = new BigDecimal(complexity);
        this.complexity = bd.setScale(4, RoundingMode.HALF_UP).doubleValue();
        bd = new BigDecimal(inheritance);
        this.inheritance = bd.setScale(4, RoundingMode.HALF_UP).doubleValue();
        bd = new BigDecimal(maintainability);
        this.maintainability = bd.setScale(4, RoundingMode.HALF_UP).doubleValue();
        bd = new BigDecimal(readability);
        this.readability = bd.setScale(4, RoundingMode.HALF_UP).doubleValue();
        bd = new BigDecimal(reuseablity);
        this.reuseablity = bd.setScale(4, RoundingMode.HALF_UP).doubleValue();
        bd = new BigDecimal(testability);
        this.testability = bd.setScale(4, RoundingMode.HALF_UP).doubleValue();
        bd = new BigDecimal(extendability);
        this.extendability = bd.setScale(4, RoundingMode.HALF_UP).doubleValue();
        bd = new BigDecimal(security);
        this.security = bd.setScale(4, RoundingMode.HALF_UP).doubleValue();
    }
}